sample.cls


VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "Class1"
Attribute VB_Creatable = True
Attribute VB_Exposed = True
Option Explicit
'/******************************************************************/
'/*                                                                */
'/*                      TurboCAD for Windows                      */
'/*                   Copyright (c) 1993 - 1996                    */
'/*             International Microcomputer Software, Inc.         */
'/*                            (IMSI)                              */
'/*                      All rights reserved.                      */
'/*                                                                */
'/******************************************************************/

'DBAPI constants
Const gkGraphic = 11
Const gkArc = 2
Const gkText = 6
Const gfCosmetic = 128&

'Stock property pages
Const ppStockPen = 1
Const ppStockBrush = 2
Const ppStockText = 4
Const ppStockInsert = 8
Const ppStockViewport = 16
Const ppStockAuto = 32

'Real variant types!
Const typeEmpty = 0
Const typeInteger = 2
Const typeLong = 3
Const typeSingle = 4
Const typeDouble = 5
Const typeCurrency = 6
Const typeDate = 7
Const typeString = 8
Const typeObject = 9
Const typeBoolean = 11
Const typeVariant = 12
Const typeIntegerEnum = typeInteger + 100
Const typeLongEnum = typeLong + 100
Const typeStringEnum = typeString + 100

'Property Ids

'Property enums

'Number of properties, pages, wizards
Const NUM_PROPERTIES = 0
Const NUM_PAGES = 0
Const NUM_WIZARDS = 0


Private Sub Class_Initialize()
    'Initialize class variables
End Sub

'Returns the user-visible description of this RegenMethod

Public Property Get Description() As String
    Description = "Sample RegenMethod"
End Property

'Returns the persistent class id for this RegenMethod's property section

Public Property Get ClassID() As String
    ClassID = "{D25185FF-6A20-11d0-A115-00A024158DAF}"
End Property

'Retrieve types and names

Public Function GetPropertyInfo(Names As Variant, Types As Variant, IDs As Variant, Defaults As Variant) As Long
    ReDim Names(NUM_PROPERTIES), Types(NUM_PROPERTIES), IDs(NUM_PROPERTIES), Defaults(NUM_PROPERTIES)
    GetPropertyInfo = NUM_PROPERTIES
End Function

'Get the number of property pages supporting this RegenMethod

Public Function GetPageInfo(ByVal AGraphic As Object, StockPages As Long, Names As Variant) As Long
    ReDim Names(NUM_PAGES)

    'Need the form
    Load frmSample
    Names(0) = frmSample.Caption
    Unload frmSample

    StockPages = ppStockPen + ppStockBrush + ppStockAuto

    GetPageInfo = NUM_PAGES
End Function


Public Function GetWizardInfo(Names As Variant) As Long
    ReDim Names(NUM_WIZARDS)
    GetWizardInfo = NUM_WIZARDS
End Function

'Enumerate the names and values of a specified property

Public Function GetEnumNames(ByVal PropID As Long, Names As Variant, Values As Variant) As Long
    GetEnumNames = 0
End Function


Public Function PageControls(ByVal ThisRegenMethod As Object, ByVal Graphic As Object, ByVal PageNumber As Long, ByVal SaveProperties As Boolean) As Boolean
        On Error GoTo Failed
        PageControls = True
        Exit Function

Failed:
        PageControls = False
End Function


Public Function PageDone(ByVal ThisRegenMethod As Object, Optional PageNumber As Variant)
        'Done with form
        Unload frmSample
End Function


Public Function PropertyPages(ByVal ThisRegenMethod As Object, Optional PageNumber As Variant) As Boolean
    With frmSample
        .Show vbModal
        PropertyPages = Not .DialogCanceled
    End With
End Function


Public Function Wizard(ByVal ThisRegenMethod As Object, Optional WizardNumber As Variant) As Boolean
    Wizard = False
End Function

'Called when vertex has been moved, or other geometry change

Public Function OnGeometryChanged(ByVal Graphic As Object, ByVal GeomID As Long, paramOld As Variant, paramNew As Variant)
    'Do nothing
End Function

'Called when vertex is moved, or other geometry change

Public Function OnGeometryChanging(ByVal Graphic As Object, ByVal GeomID As Long, paramOld As Variant, paramNew As Variant) As Boolean
    'OK to continue with change
    OnGeometryChanging = True
End Function


Public Function OnNewGraphic(ByVal grfThis As Object, ByVal boolCopy As Boolean) As Boolean
    If boolCopy Then 'Vertices are already added for us...
        OnNewGraphic = True
        Exit Function
    End If

    'X, Y, Z, PenDown, Selectable, Snappable, Editable, Linkable, Cosmetic
    grfThis.Vertices.Add 0#, 0#, 0#, False, True, True, True, True
    OnNewGraphic = True
End Function

'Function called whenever a copy of a graphic is being made

Public Function OnCopyGraphic(ByVal grfCopy As Object, ByVal grfSource As Object) As Boolean
    'Return false on failure
    OnCopyGraphic = True
End Function

'Notification function called after graphic property is saved

Public Function OnPropertyChanged(ByVal Graphic As Object, ByVal PropID As Long, _
	ValueOld As Variant, ValueNew As Variant)
    'Do nothing
End Function

'Notification function called when graphic property is saved

Public Function OnPropertyChanging(ByVal Graphic As Object, ByVal PropID As Long, _
	ValueOld As Variant, ValueNew As Variant) As Boolean
    'OK to proceed
    OnPropertyChanging = True
End Function

'Notification function called when graphic property is retrieved

Public Function OnPropertyGet(ByVal Graphic As Object, ByVal PropID As Long)
    'Do nothing
End Function

'Called when graphic's internal structure needs to be updated

Public Function Regen(ByVal grfThis As Object)
        'Setup error handler
        On Error Resume Next
        Err.Clear

        'Set up lock
        Dim lockCount&
        lockCount& = grfThis.RegenLock
        If lockCount& = 0 Then
            'Delete previous cosmetic children
            grfThis.Graphics.Clear gfCosmetic
        End If

        'Remove lock
        grfThis.RegenUnlock
End Function



SDK Top API Reference TurboCAD Home Page TurboCAD Programming Forums